package com.bjpowernode.mvc.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bjpowernode.db.domain.RechargeRecord;
import com.bjpowernode.mvc.service.BaseService;
import com.bjpowernode.mvc.service.inter.RechargeService;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class RechargeServiceImpl extends BaseService implements RechargeService {

    private String BLACK = " ";

    @Override
    public List<RechargeRecord> queryRechargeByUid(Integer userId, Integer pageNo, Integer pageSize) {
        int offset = (pageNo - 1) * pageSize;
        //单表.
        QueryWrapper<RechargeRecord> wrapper = new QueryWrapper<>();
        wrapper.eq("uid", userId).orderByDesc("recharge_time").last("limit " + BLACK + offset + "," + pageSize);
        return rechargeRecordMapper.selectList(wrapper);
    }
}
